<?php
class lihat_proyek extends CI_Controller {

	function index()
	{
		
		
	}
	
	function display($id_status=0,$limit=2,$offset=0){
		
		$id_status = $this->input->post('id_status');
		if(!isset($id_status))
		$id_status = 0;

		$this->load->model('proyek_model','proyek');
		$this->load->model('status_proyek_model','status_proyek');
		
		$config['base_url'] = site_url('lihat_proyek/display/'.$id_status.'/'.$limit).'/';
		$config['total_rows'] = $this->proyek->count_by_status(2147483637 ,$id_status);
		$config['per_page'] = 2;
		$config['uri_segment'] = 5;
			
		$this->pagination->initialize($config);
		
		$data['proyek']=$this->proyek->get_by_status(2147483637,$id_status,'desc', $offset,$limit);
		$data['status_proyek']=$this->status_proyek->get_all();
		$data['id_status']=$id_status;
		$this->load->view('lihat_proyek_view',$data);
	}
	
	function detail_proyek($id_proyek){
	
		$this->load->model('proyek_model','proyek');
		$this->load->model('status_proyek_model','status_proyek');
		$this->load->model('paket_promosi_model','promosi');
		$data['promosi']=$this->promosi->get_promosi_by_project($id_proyek);
		$data['status_proyek']=$this->status_proyek->get_all();
		$data['proyek']=$this->proyek->get_proyek($id_proyek);
	
		$this->load->view('detail_proyek_view',$data);
	}
	
	function ubah_status($id_proyek){
		$this->load->model('proyek_model','proyek');
		
		$id_status = $this->input->post('id_status');
		$proyek = $this->proyek->get_plain_proyek($id_proyek);
		$proyek->id_status_proyek = $id_status;
		$this->proyek->update($id_proyek,$proyek);
		$this->detail_proyek($id_proyek);
	}
}
?>